Update generated formulas to follow the new naming scheme - #350
Conversation
fd75584 to
068f61b
Compare
|
Need to add tests for the |
fa71205 to
f6fb8cb
Compare
f6fb8cb to
11363e5
Compare
cwasicki
left a comment
There was a problem hiding this comment.
Some high-level comments. Most importantly I think the methods for solar are missing.
3c8d3c1 to
21e6e6a
Compare
f9f6884 to
72ee63c
Compare
|
Rebased on latest. |
| f"{meter.category}. Expected ComponentCategory.METER." | ||
| ) | ||
| meter_successors = component_graph.successors(meter.component_id) | ||
| if len(meter_successors) != 1: |
There was a problem hiding this comment.
Is that check necessary? Seems to me that we would disallow a valid grid topology, where one meter is measuring more then 1 CHPs?
|
|
||
| @abstractmethod | ||
| def is_battery_chain(self, component: Component) -> bool: | ||
| """Check if the specified component is part of a battery chain. |
There was a problem hiding this comment.
I suggest to use the docs to define what a battery chain is.
|
|
||
| @abstractmethod | ||
| def is_ev_charger_chain(self, component: Component) -> bool: | ||
| """Check if the specified component is part of an EV charger chain. |
|
|
||
| @abstractmethod | ||
| def is_chp_chain(self, component: Component) -> bool: | ||
| """Check if the specified component is part of a CHP chain. |
| return self._gen_with_grid_meter(builder, grid_meter) | ||
| return self._gen_without_grid_meter(builder, grid_successors) | ||
|
|
||
| def _gen_with_grid_meter( |
There was a problem hiding this comment.
We need to be careful here since this stops working once we add sub panels (Unterverteilungen) into the microgrid api. Maybe it's worth adding a comment here.
There was a problem hiding this comment.
Are we going to introduce sub panels into the component graph? I haven't heard of any such plans. Those are passive components right? i.e we can't read from them or control them.
There was a problem hiding this comment.
As far as I remember that was the plan. @tiyash-basu-frequenz can you confirm?
There was a problem hiding this comment.
I suggest to add a short warning comment to the documentation such that we are aware in the future.
There was a problem hiding this comment.
I have added a comment:
If the component graph supports additional types of grid successors in the future, additional checks need to be added here.
There was a problem hiding this comment.
I think the term "sub panels" is misleading. If I have understood it correctly, then it is a section of the microgrid behind a dedicated fuse. I'd call it sub-section.
But I'd suggest ignoring it for now. It is not scheduled to be added to the microgrid API soon. To me even a comment seems unnecessary: because it does not improve the readability and just hints at a future functionality without knowing when we will add it. But up to you.
There was a problem hiding this comment.
If you really want to track this feature, then creating an issue is the proper way to do it.
There was a problem hiding this comment.
You are right w.r.t. the issue. We should create one but I'd also leave a comment just to have the behavior documented because it tells that the algorithm isn't going into the depth.
There was a problem hiding this comment.
Then I'd suggest to rather create the issue and add a link to the issue in the comment.
I'd suggest doing it in moderation, if never at all, because you do not want to end up adding every proposed feature in the comments.
13e7fe1 to
7c30e4c
Compare
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
This is useful for switching the sign of values, by multiplying by -1, for example. Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
7c30e4c to
bb1ece8
Compare
matthias-wende-frequenz
left a comment
There was a problem hiding this comment.
Approved apart from my last comment.
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
The battery power formula has been moved to the battery pool, and is being tested there. And a new test for the new PV Power methods was added in the previous commit. Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
Signed-off-by: Sahas Subramanian <sahas.subramanian@frequenz.com>
New power streaming methods - public api
BatteryPool.{production_power, consumption_power}EVChargerPool.{production_power, consumption_power}consumer_powergrid_production_powergrid_consumption_powerchp_powerchp_production_powerchp_consumption_power(probably not necessary, but having just a production method was a bit weird)New FormulaEngine steps - internal
ConstantValue- for multiplying formula outputs with-1to get production power.Clipper- for clipping formula outputs to 0.0 in production/consumption power formulas.New component graph methods - internal
is_pv_inverter,is_pv_meter,is_pv_chainis_battery_inverter,is_battery_meter,is_battery_chainis_ev_charger,is_ev_charger_meter,is_ev_charger_chain,is_chp,is_chp_meter,is_chp_chainThese methods were particularly useful in the creation of the
consumer_powerformula.The
*chainmethods return true if either of the other corresponding methods return true. Maybe there's a better name, but it is for internal use.